<?php
namespace Home\Controller;
use Lib\ChinesePinyin;
class IndexController extends CommonController {

	public function _initialize()
	{
		$this->Is_login();        //检测用户登录信息,如果错误直接返回错误,终止程序
		$this->assign('heardadminData',cookie('heardadminData'));
		$this->assign('heardadminPower',cookie('heardadminPower'));
		$this->assign('founder',cookie('founder'));
	}
	//后台首页
	public function index(){
		$this->display();
	}
		public function top()
	{
		$this->display();
	}

	public function left()
	{
		$this->display();
	}
	public function main(){
		$this->display();
	}
	public function refresh_ajax(){
		$sex = cookie('sex');
		if(!$sex){
			$adminid = urlsafe_b64decode(cookie('heardadminData'));
			$sex = M('admin')->where("heard_admin_id = $adminid")->getField('sex');
		}
		$data['sendorder'] = M("order")->where("type=4 and status=1 and sex in (0,$sex)")->count();
		$data['member'] = M("member")->where("status=8")->count();
		$where = "status=9 and (emotion_audio_type=2 or variety_audio_type=2 or news_audio_type=2 or introduction_audio_type=2) ";
		$data['auditagain'] = M("member m")->join('__DATA__ d ON m.uuid = d.uuid')->where($where)->field('m.id')->count();
		$data['allmember'] = $data['member']+$data['auditagain'];
		$data['sendorder_count'] = M('order')->where('(type=3 or type=4) and status = 1')->count();
		exit(json_encode($data));
	}
}